@@ -3,10 +3,14 @@ |
||
3 | 3 |
import redis |
4 | 4 |
|
5 | 5 |
|
6 |
-def redis_connect(conf): |
|
7 |
- return redis.StrictRedis(connection_pool=redis.ConnectionPool(**{ |
|
6 |
+def redis_conf(conf): |
|
7 |
+ return { |
|
8 | 8 |
'host': conf.get('HOST', 'localhost'), |
9 | 9 |
'port': conf.get('PORT', 6379), |
10 | 10 |
'password': '{}:{}'.format(conf.get('USER', ''), conf.get('PASSWORD', '')) if conf.get('USER') else '', |
11 | 11 |
'db': conf.get('db', 0), |
12 |
- })) |
|
12 |
+ } |
|
13 |
+ |
|
14 |
+ |
|
15 |
+def redis_connect(conf): |
|
16 |
+ return redis.StrictRedis(connection_pool=redis.ConnectionPool(**redis_conf(conf))) |